<html>
<head><meta charset="utf-8"><title>function pointer Debug · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html">function pointer Debug</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="167573183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167573183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167573183">(Jun 07 2019 at 12:47)</a>:</h4>
<p>Where about is the code for implementing <code>Debug</code> for function pointers? It has some weird bug on AVR with respect to address spaces.</p>



<a name="167573388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167573388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> yodal <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167573388">(Jun 07 2019 at 12:50)</a>:</h4>
<p>Whenever I can't find certain code I go digging in the generated docs for rustc. I'm unsure if it will help in this case, but it might.</p>



<a name="167573679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167573679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167573679">(Jun 07 2019 at 12:54)</a>:</h4>
<p>Oh, these might not be special implementations</p>



<a name="167573703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167573703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167573703">(Jun 07 2019 at 12:54)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/src/libcore/ptr/mod.rs#L2638-L2643" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/libcore/ptr/mod.rs#L2638-L2643">https://github.com/rust-lang/rust/blob/master/src/libcore/ptr/mod.rs#L2638-L2643</a></p>



<a name="167573720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167573720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167573720">(Jun 07 2019 at 12:55)</a>:</h4>
<p>I would have thought they were magically implemented for every number of args</p>



<a name="167573722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167573722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167573722">(Jun 07 2019 at 12:55)</a>:</h4>
<p>but they are limited to 12</p>



<a name="167573903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167573903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167573903">(Jun 07 2019 at 12:57)</a>:</h4>
<p>For context, on AVR this IR is generated</p>
<div class="codehilite"><pre><span></span>  <span class="nv nv-Anonymous">%3</span> <span class="p">=</span> <span class="k">addrspacecast</span> <span class="p">{}</span> <span class="k">addrspace</span><span class="p">(</span><span class="m">1</span><span class="p">)*</span> <span class="nv nv-Anonymous">%2</span> <span class="k">to</span> <span class="p">{}*</span>
  <span class="nv nv-Anonymous">%4</span> <span class="p">=</span> <span class="k">ptrtoint</span> <span class="p">{}*</span> <span class="nv nv-Anonymous">%3</span> <span class="k">to</span> <span class="k">i16</span>
</pre></div>


<p>Which it doesn't know how to handle</p>



<a name="167579057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167579057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> yodal <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167579057">(Jun 07 2019 at 14:02)</a>:</h4>
<p>did it used to make create correct IR or has this always been broken</p>



<a name="167579110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167579110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> yodal <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167579110">(Jun 07 2019 at 14:03)</a>:</h4>
<p>I know AVR has always been an out-of-band project</p>



<a name="167582820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167582820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167582820">(Jun 07 2019 at 14:43)</a>:</h4>
<p>It worked at some point, but we are trying to upgrade the version of Rust we are based on</p>



<a name="167582830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167582830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167582830">(Jun 07 2019 at 14:43)</a>:</h4>
<p>This would be an update since circa December, I think.</p>



<a name="167582924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167582924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167582924">(Jun 07 2019 at 14:44)</a>:</h4>
<p>which makes identifying the rust commit fun and annoying ;-)</p>



<a name="167582937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167582937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167582937">(Jun 07 2019 at 14:44)</a>:</h4>
<p><a href="https://github.com/avr-rust/rust/pull/137" target="_blank" title="https://github.com/avr-rust/rust/pull/137">the context</a>, if you are interested.</p>



<a name="167586111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167586111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> yodal <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167586111">(Jun 07 2019 at 15:23)</a>:</h4>
<p>All I can say to that upgrade is oof</p>



<a name="167586188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167586188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> yodal <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167586188">(Jun 07 2019 at 15:24)</a>:</h4>
<p>I may look at this later, but you could probably narrow your commit search to changes in the codegen libs</p>



<a name="167586228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167586228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> yodal <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167586228">(Jun 07 2019 at 15:24)</a>:</h4>
<p>that would probably cut your search domain by an order of magnitude</p>



<a name="167586394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167586394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167586394">(Jun 07 2019 at 15:26)</a>:</h4>
<p>And the update is already out of date, so once we get that we will need to do it again ;-)</p>



<a name="167586893"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/function%20pointer%20Debug/near/167586893" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> yodal <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/function.20pointer.20Debug.html#167586893">(Jun 07 2019 at 15:32)</a>:</h4>
<p>such is how it is with large PRs</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>